//
//  XYReadDetaillsView.swift
//  XYReadBook
//
//  Created by fox on 2017/10/7.
//  Copyright © 2017年 tsaievan. All rights reserved.
//


import UIKit
import CoreText

class XYReadDetaillsView: UIView {
    // XWJPurchaseView

    var frameRef: CTFrame
    var txtTeight: CGFloat

    init(frameRef: CTFrame, txtTeight: CGFloat) {
        self.frameRef = frameRef
        self.txtTeight = txtTeight
     super.init(frame: CGRect.init(x: 0, y: 25, width: ScreenWidth, height: ScreenHeight - 45))
        self.backgroundColor = UIColor.black
    }


    override func layoutSubviews() {
        super.layoutSubviews()

    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override func draw(_ rect: CGRect) {
        let ctx = UIGraphicsGetCurrentContext()
        ctx?.textMatrix = CGAffineTransform.identity
        ctx?.translateBy(x: 0, y: txtTeight + 40)
        ctx?.scaleBy(x: 1.0, y: -1.0);
        CTFrameDraw(frameRef, ctx!);
    }
}
